package util;

import java.io.UnsupportedEncodingException;
import java.util.Base64;

public class BaseEncoding {
    public static String encoding( String text){
        final Base64.Decoder decoder = Base64.getDecoder();
        final Base64.Encoder encoder = Base64.getEncoder();
        byte[] textByte = new byte[0];
        String encodedText = "";
        try {
            textByte = text.getBytes("UTF-8");
            encodedText = encoder.encodeToString(textByte);
//            System.out.println(encodedText);

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return encodedText;

        //编码

    }

}
